add walk-up config discovery and configurable source root#270
Merged
Conversation
1dfeb79 to
0ab4cdd
Compare
Implements propose/active/DIRS-HIERARCHY-PROPOSE.md as a single PR. - discover_project_root(start) walks from start upward looking for .java-codebase-rag.yml/.yaml, first match wins, stops at $HOME (inclusive). Mirrors git's .git discovery. - resolve_operator_config() uses two-phase resolution: phase 1 finds the config file directory via walk-up, phase 2 resolves effective source root from CLI > env > YAML source_root > discovery > cwd. - server.py _project_root() and _resolve_lancedb_uri() use walk-up when JAVA_CODEBASE_RAG_SOURCE_ROOT is unset. - cli.py init emits a soft warning when a parent config is detected. - YAML config gains an optional source_root field resolved relative to the config file directory (not cwd). - mcp.json.example shows minimal zero-env-var config. - README and CONFIGURATION docs updated for walk-up and source_root. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- server.py main() passes source_root=None to resolve_operator_config so YAML source_root is resolved in Phase 2, not skipped. The previous code passed _project_root() as source_root, which caused the CLI path to skip YAML resolution (C1 from code review). - cli.py _cmd_diagnose_ignore uses cfg.source_root instead of server._project_root() to avoid divergence when YAML source_root is set (I3 from code review). - add test for YAML source_root resolution via server path. - add tests for init parent-config warning detection. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0ab4cdd to
4395e64
Compare
Update test_mcp_server_loads_yaml_config_at_startup and test_mcp_server_yaml_config_precedence_env_over_yaml to expect resolve_operator_config(source_root=None) instead of the old resolve_operator_config(source_root=_project_root()). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
propose/active/DIRS-HIERARCHY-PROPOSE.mdandplans/active/PLAN-DIRS-HIERARCHY.md(PR-1)..java-codebase-rag.yml/.yaml, like git finds.git. First match wins, stops at$HOME(inclusive).source_rootYAML field: Optional YAML key resolved relative to the config file directory (not cwd). Useful for monorepos where the config lives above the Java source tree.--source-root>JAVA_CODEBASE_RAG_SOURCE_ROOTenv > YAMLsource_root> walk-up discovery > cwd.initparent-config warning:initprints a soft warning to stderr if a config exists in an ancestor directory.mcp.json.exampleupdated with a minimal zero-env-var config. README and CONFIGURATION docs updated.Files changed
java_codebase_rag/config.pydiscover_project_root(), two-phaseresolve_operator_config()server.py_project_root()and_resolve_lancedb_uri()use walk-upjava_codebase_rag/cli.pyinitparent-config warningtests/test_config.pytests/test_mcp_server_project_root.py_project_root()walk-upREADME.mddocs/CONFIGURATION.mdsource_rootYAML field, walk-up docsmcp.json.exampleTest plan
JAVA_CODEBASE_RAG_RUN_HEAVYruff check .cleanjava-codebase-rag metafrom a subdirectory of an indexed project — should discover config via walk-up🤖 Generated with Claude Code